﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace NFramework.DataAccess
{
    class CommandParameter : IDbDataParameter
    {

        public CommandParameter(IDbDataParameter innerParameter)
        {
            _inner = innerParameter;
        }
        private IDbDataParameter _inner;

        #region [ IDbDataParameter Members ]

        public byte Precision
        {
            get
            {
                return _inner.Precision;
            }
            set
            {
                _inner.Precision = value;
            }
        }

        public byte Scale
        {
            get
            {
                return _inner.Scale;
            }
            set
            {
                _inner.Scale = value;
            }
        }

        public int Size
        {
            get
            {
                return _inner.Size;
            }
            set
            {
                _inner.Size = value;
            }
        }

        #endregion

        #region [ IDataParameter Members ]

        public DbType DbType
        {
            get
            {
                return _inner.DbType;
            }
            set
            {
                _inner.DbType = value;
            }
        }

        public ParameterDirection Direction
        {
            get
            {
                return _inner.Direction;
            }
            set
            {
                _inner.Direction = value;
            }
        }

        public bool IsNullable
        {
            get { return _inner.IsNullable; }
        }

        public string ParameterName
        {
            get
            {
                return _inner.ParameterName;
            }
            set
            {
                _inner.ParameterName = value;
            }
        }

        public string SourceColumn
        {
            get
            {
                return _inner.SourceColumn;
            }
            set
            {
                _inner.SourceColumn = value;
            }
        }

        public DataRowVersion SourceVersion
        {
            get
            {
                return _inner.SourceVersion;
            }
            set
            {
                _inner.SourceVersion = value;
            }
        }

        public object Value
        {
            get
            {
                return _inner.Value;
            }
            set
            {
                if (value == null)
                {
                    _inner.Value = DBNull.Value;
                }
                else
                {
                    _inner.Value = value;
                }
            }
        }

        #endregion

    }
}
